# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=deepin-image-viewer
pkgver=5.9.11
pkgrel=2
pkgdesc='An image viewing tool with fashion interface and smooth performance'
arch=('loong64' 'x86_64')
url="https://github.com/linuxdeepin/deepin-image-viewer"
license=('GPL3')
depends=('deepin-qt5integration' 'deepin-image-editor' 'libexif' 'libraw' 'qt5-svg')
makedepends=('cmake' 'ninja' 'qt5-tools')
optdepends=('deepin-manual: for help manual'
            'deepin-shortcut-viewer: for shortcut display')
groups=('deepin')
source=("$pkgname-$pkgver.tar.gz::https://github.com/linuxdeepin/deepin-image-viewer/archive/$pkgver.tar.gz"
         libraw-0.21.patch)
sha512sums=('e88cc8983fbf9781c3a9fae4ddb1e9ddaa5a7d4adcda6ac576e28b5a1dcc22d9eb15a5fb08cf0d8d2602f1003eb27a2ad410402bc33293c1bb6d785a53ae05a9'
            '37587172bb74d6e243ae34120f6d0f27c5aa0ce46fc3faf53878c2827811ba922370820c62715f406bbfe9ebf14dbfc0042b85dc0ee7c51c3a4da08d840b7fd4')

prepare() {
  cd deepin-image-viewer-$pkgver
  sed -i -e 's|qt5/plugins|qt/plugins|' -e 's|${Qt5Core_DIR}|/usr/lib/cmake/Qt5Core|' qimage-plugins/libraw/CMakeLists.txt
  patch -p1 < ../libraw-0.21.patch # Fix build with libraw 0.21
}

build() {
  cd deepin-image-viewer-$pkgver
  cmake . -GNinja -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_LIBDIR=lib
  ninja
}

package() {
  cd deepin-image-viewer-$pkgver
  DESTDIR="$pkgdir" ninja install
}
